import type { RoleItem } from './rolesModel'

import type { ApiPagination } from '#types/utils'

export interface UserPageListItem {
    id: number
    realname: null | string
    nickname: string
    gender: number
    genderName: string
    avatar: null | string
    mobile: null | string
    email: null | string
    birthday: null | string
    deptId: number
    levelId: number
    levelName: null | string
    positionId: number
    positionName: null | string
    provinceCode: string
    cityCode: string
    districtCode: string
    city: string[]
    address: null | string
    cityName: null | string
    username: string
    password: string
    salt: null | string
    intro: null | string
    status: number
    note: null | string
    sort: number
    loginNum: number
    loginIp: null | string
    loginTime: null | string
    createUser: number
    createTime: string
    updateUser: number
    updateTime: string
    mark: number
    roles: RoleItem[]
}

// 用户管理分页
export type UserPageListResult = ApiPagination<UserPageListItem>

export type UserItemForm = Pick<
    UserPageListItem,
    | 'address'
    | 'birthday'
    | 'city'
    | 'cityCode'
    | 'cityName'
    | 'deptId'
    | 'districtCode'
    | 'email'
    | 'gender'
    | 'intro'
    | 'mobile'
    | 'nickname'
    | 'note'
    | 'positionId'
    | 'provinceCode'
    | 'realname'
    | 'sort'
    | 'status'
    | 'username'
> & {
    password?: string
    roleIds: number[]
}
